﻿using Newtonsoft.Json;
using System.Collections.Generic;
using Polenter.Serialization;

namespace SmartMotion.Core
{
    /// <summary>
    /// IO控制器接口,继承这个接口的可能有运动控制器，PLC，机械手，IO卡
    /// </summary>

    public interface IIOCtrl
    {
        ushort CardID { get; set; }

        bool InitIoCtrl();

        bool CloseIoCtrl();

        int ReadInBit(ushort bitNo);

        int ReadOutBit(ushort bitNo);

        int ReadInPort(ushort portNo);

        int ReadOutPort(ushort portNo);

        int WriteOutbit(ushort bitNo, ushort onOff);

        int WriteOutPort(ushort portNo, ushort portValue);

        /// <summary>
        /// IO卡能用的数字输入list,需要在卡的构造函数里初始化，digital input
        /// </summary>
        [ExcludeFromSerialization]
        List<IOIn> DI { get; }

        [ExcludeFromSerialization]
        List<IOIn> DIInuse { get; }

        /// <summary>
        /// IO卡能用的数字输出list,需要在卡的构造函数里初始化 digital output
        /// </summary>
        [ExcludeFromSerialization]  
        List<IOOut> DO { get; }
        [ExcludeFromSerialization]  
        List<IOOut> DOInuse { get; }
        List<string> DIID { get; set; }

        List<string> DOID { get; set; }

        List<string> DIIDInUse { get; set; }

        List<string> DOIDInUse { get; set; }    
    }
}   